package homework6;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/h6Servlet")
public class h6Servlet extends HttpServlet{

	/**
	 * AJAX请求方式进行验证码校验，在客户端给出正确提示。
	 */
	private static final long serialVersionUID = 1L;
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String yzm=req.getParameter("yzm");
		Object yzmSession=req.getSession().getAttribute("verifycode");
		String r="";
		if(!yzmSession.toString().equals(yzm))
			r= "F";
		else r="T";
		System.out.println("r========"+r);
		PrintWriter out=resp.getWriter();
		out.append(r);
		out.flush();
		out.close();
		out=null;
	}

}
